package com.jht.mymvvm.activity.scollview

import android.os.Bundle
import android.view.View
import android.widget.ScrollView

import androidx.appcompat.app.AppCompatActivity
import androidx.core.widget.NestedScrollView
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.jht.mymvvm.R
import com.scwang.smart.refresh.layout.SmartRefreshLayout

class ScollActivity : AppCompatActivity() {
    lateinit var mRefreshLayout: SmartRefreshLayout;
    lateinit var mLvBleDevices: RecyclerView;
    lateinit var parent: NestedScrollView
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_scoll)

        mRefreshLayout = findViewById(R.id.refresh_layout);
        mLvBleDevices = findViewById(R.id.lv_ble_devices);
        mRefreshLayout.setOnRefreshListener { //判断蓝牙和定位是否开启

            mRefreshLayout.finishRefresh(1000)
        }
        parent = findViewById(R.id.parent);

        mLvBleDevices.layoutManager = LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)

        mLvBleDevices.adapter = ListAdapters(this)
        parent.setOnScrollChangeListener{ view: View, i: Int, i1: Int, i2: Int, i3: Int ->
            if (parent.scrollY == 0 ){

            }
        }



    }
}